#include "ConfigTest.h"
#include <memory.h>
#include <sstream>

CPPUNIT_TEST_SUITE_REGISTRATION(CConfigTestCase);

void CConfigTestCase::setUp()
{
  m_config = new CConfig();
}

void CConfigTestCase::tearDown()
{
  delete m_config;
}

static const char *AUX_FILENAME = "test_config.conf";
static const std::string TEST_STRINGS[CE_MAXENTRY] = {
  "/etc/rtmpd.conf",
  "45000",
  "1000",
  "46000",
  "1000",
  "speex",
  "192.168.0.1",
  "192.168.0.2",
  "192.168.0.3"
};

void CConfigTestCase::InitTest()
{
  CPPUNIT_ASSERT(m_config->Init(AUX_FILENAME));
  // kontrola spravnosti nactenych hodnot ze souboru
  for(int i = 0; i < CE_MAXENTRY; i++) {
    CPPUNIT_ASSERT_EQUAL(TEST_STRINGS[i], m_config->GetConfigEntry((ConfigEntry)i));
  }
}

